//
//  LaunchHandler.m
//  ZZmetro
//
//  Created by 一介布衣 on 2020/6/5.
//  Copyright © 2020 一介布衣. All rights reserved.
//

#import "LaunchHandler.h"
#import "HomeController.h"
#import "LoginController.h"
#import "WelcomeController.h"
#import "HomeViewController.h"
#import "WebViewController.h"

@implementation LaunchHandler


+ (void)luanchToWindow:(UIWindow*)window{
    [LaunchHandler toWelcomeController];
    //[LaunchHandler toHomeController];
}

+ (void)toWelcomeController{
    [UIViewController setNavigationBarWithStyle:NAV_BAR_STYLE_2];
    WelcomeController *tmp = [WelcomeController new];
    SharedAppDelegate.window.rootViewController = tmp;
    [SharedAppDelegate.window makeKeyAndVisible];
}

+ (void)toHomeController
{
    [UIViewController setNavigationBarWithStyle:NAV_BAR_STYLE_2];
    //HomeController *rootCtl = [HomeController new];
    HomeViewController *rootCtl = [HomeViewController new];
    //WebViewController *rootCtl = [WebViewController new];
    //rootCtl.url = @"https://www.baidu.com/";
    UINavigationController *navCtl = [[UINavigationController alloc] initWithRootViewController:rootCtl];
    SharedAppDelegate.window.rootViewController = navCtl;
    [SharedAppDelegate.window makeKeyAndVisible];
}

+ (void)toLoginController
{
    UIViewController *currentCtl = SharedAppDelegate.currentCtl;
    if ([currentCtl isKindOfClass:[LoginController class]]){
        return;
    }
    
    [UIViewController setNavigationBarWithStyle:NAV_BAR_STYLE_3];
    
    LoginController *loginCtl = [[LoginController alloc] init];
    UINavigationController *navCtl = [[UINavigationController alloc] initWithRootViewController:loginCtl];
    SharedAppDelegate.window.rootViewController = navCtl;
    [SharedAppDelegate.window makeKeyAndVisible];
}
@end
